#ifndef GovSteamEU_H
#define GovSteamEU_H

#include "TurbineGovernorDynamics.hpp"
#include <list>
#include "Boolean.hpp"
#include "Float.hpp"


#include "ActivePower.hpp"
#include "Seconds.hpp"
#include "PU.hpp"
#include "Simple_Float.hpp"

namespace CIMPP {


	/*
	Simplified model  of boiler and steam turbine with PID governor.
	*/
	class GovSteamEU: public TurbineGovernorDynamics
	{

	public:
					CIMPP::ActivePower mwbase; 	/* Base for power values (MWbase) (&gt;0).  Unit = MW. Default: nullptr */
					CIMPP::Seconds tp; 	/* Power transducer time constant (Tp).  Typical Value = 0.07. Default: nullptr */
					CIMPP::PU ke; 	/* Gain of the power controller (Ke).  Typical Value = 0.65. Default: nullptr */
					CIMPP::Seconds tip; 	/* Integral time constant of the power controller (Tip).  Typical Value = 2. Default: nullptr */
					CIMPP::Seconds tdp; 	/* Derivative time constant of the power controller (Tdp).  Typical Value = 0. Default: nullptr */
					CIMPP::Seconds tfp; 	/* Time constant of the power controller (Tfp).  Typical Value = 0. Default: nullptr */
					CIMPP::Seconds tf; 	/* Frequency transducer time constant (Tf).  Typical Value = 0. Default: nullptr */
					CIMPP::PU kfcor; 	/* Gain of the frequency corrector (Kfcor).  Typical Value = 20. Default: nullptr */
					CIMPP::PU db1; 	/* Dead band of the frequency corrector (db1).  Typical Value = 0. Default: nullptr */
					CIMPP::PU wfmax; 	/* Upper limit for frequency correction (Wfmax).  Typical Value = 0.05. Default: nullptr */
					CIMPP::PU wfmin; 	/* Lower limit for frequency correction (Wfmin).  Typical Value = -0.05. Default: nullptr */
					CIMPP::PU pmax; 	/* Maximal active power of the turbine (Pmax).  Typical Value = 1. Default: nullptr */
					CIMPP::Seconds ten; 	/* Electro hydraulic transducer (Ten).  Typical Value = 0.1. Default: nullptr */
					CIMPP::Seconds tw; 	/* Speed transducer time constant (Tw).  Typical Value = 0.02. Default: nullptr */
					CIMPP::PU kwcor; 	/* Gain of the speed governor (Kwcor).  Typical Value = 20. Default: nullptr */
					CIMPP::PU db2; 	/* Dead band of the speed governor (db2).  Typical Value = 0.0004. Default: nullptr */
					CIMPP::PU wwmax; 	/* Upper limit for the speed governor (Wwmax).  Typical Value = 0.1. Default: nullptr */
					CIMPP::PU wwmin; 	/* Lower limit for the speed governor frequency correction (Wwmin).  Typical Value = -1. Default: nullptr */
					CIMPP::PU wmax1; 	/* Emergency speed control lower limit (wmax1).  Typical Value = 1.025. Default: nullptr */
					CIMPP::PU wmax2; 	/* Emergency speed control upper limit (wmax2).  Typical Value = 1.05. Default: nullptr */
					CIMPP::Seconds tvhp; 	/* Control valves servo time constant (Tvhp).  Typical Value = 0.1. Default: nullptr */
					CIMPP::Simple_Float cho; 	/* Control valves rate opening limit (Cho).  Unit = PU/sec.  Typical Value = 0.17. Default: nullptr */
					CIMPP::Simple_Float chc; 	/* Control valves rate closing limit (Chc).  Unit = PU/sec.  Typical Value = -3.3. Default: nullptr */
					CIMPP::PU hhpmax; 	/* Maximum control valve position (Hhpmax).  Typical Value = 1. Default: nullptr */
					CIMPP::Seconds tvip; 	/* Intercept valves servo time constant (Tvip).  Typical Value = 0.15. Default: nullptr */
					CIMPP::PU cio; 	/* Intercept valves rate opening limit (Cio).  Typical Value = 0.123. Default: nullptr */
					CIMPP::PU cic; 	/* Intercept valves rate closing limit (Cic).  Typical Value = -2.2. Default: nullptr */
					CIMPP::PU simx; 	/* Intercept valves transfer limit (Simx).  Typical Value = 0.425. Default: nullptr */
					CIMPP::Seconds thp; 	/* High pressure (HP) time constant of the turbine (Thp).  Typical Value = 0.31. Default: nullptr */
					CIMPP::Seconds trh; 	/* Reheater  time constant of the turbine (Trh).  Typical Value = 8. Default: nullptr */
					CIMPP::Seconds tlp; 	/* Low pressure(LP) time constant of the turbine (Tlp).  Typical Value = 0.45. Default: nullptr */
					CIMPP::PU prhmax; 	/* Maximum low pressure limit (Prhmax).  Typical Value = 1.4. Default: nullptr */
					CIMPP::PU khp; 	/* Fraction of total turbine output generated by HP part (Khp).  Typical Value = 0.277. Default: nullptr */
					CIMPP::PU klp; 	/* Fraction of total turbine output generated by HP part (Klp).  Typical Value = 0.723. Default: nullptr */
					CIMPP::Seconds tb; 	/* Boiler time constant (Tb).  Typical Value = 100. Default: nullptr */
				
		static const char debugName[];
		virtual const char* debugString();
		
		/* constructor initialising all attributes to null */
		GovSteamEU();
		virtual ~GovSteamEU();
	
		static void addConstructToMap(std::unordered_map<std::string, BaseClass* (*)()>& factory_map);
		static void addPrimitiveAssignFnsToMap(std::unordered_map<std::string, assign_function>&);
		static void addClassAssignFnsToMap(std::unordered_map<std::string, class_assign_function>&);
		static const BaseClassDefiner declare();

	};

	BaseClass* GovSteamEU_factory();
}
#endif
